package com.example.mangareaderexe;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter{
	private Context mContext;
	
	private Integer[] mThumbsIds = {
			R.drawable.dragonballafchap1_page1,
			R.drawable.dragonballafchap2_page1,
			R.drawable.dragonballafchap3_page1,
			R.drawable.dragonballafchap4_page1
	};
	public ImageAdapter(Context c){
		mContext = c;
	}
	

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mThumbsIds.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageView imageView;
		if(convertView == null){
			imageView = new ImageView(mContext);
			imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
			imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
			imageView.setPadding(3, 3, 3, 3);
		}
		else{
			imageView = (ImageView) convertView;
		}
		imageView.setImageResource(mThumbsIds[position]);
		return imageView;
	}

}
